/** Definition of the Scanner class.
 * @file 
 * @author Jeremy Schultz
 */

#ifndef	__SCANNER_H_
#define	__SCANNER_H_

#include <iostream>
#include <sstream>
#include <assert.h>
#include "Administration.h"
#include "Token.h"
#include "Numeric.h"
#include "Word.h"
#include "SymbolTable.h"

using namespace std;

/** Used by the parser to retrieve Tokens from the source file.
 */
class Scanner	{
	private:
		std::istream* in;		/**< Source to compile */
		SymbolTable::SymbolTable* symbolTable;	/**< Symbol Table in use */
		Administration* admin;	/**< Administration, provides error handling */

		int lineNum;			/**< Current line number being processed */
		bool lookAhead;			/**< Is there a look ahead token */
		Token *lookAheadToken;	/**< The look ahead token */
		bool eofOccured;		/**< EOF has occured */

		/** Skip the white space in the input stream.
		 * White space consists of new lines, tabs, spaces and comments.
		 * Comments start with '$" until the end of line.
		 */
		void Scanner::SkipWhiteSpace();

	public:
		/** Constructor .
		 * @param _in The input stream (source file)
		 * @param _symbolTable The symbol table to use will scanning
		 * @param _admin	The Administration class, provides error handling
		 */
		Scanner(std::istream* _in, SymbolTable::SymbolTable* _symbolTable, Administration* _admin);


		/** Getter - lineNum.
		 * @return The line number
		 */
		int Scanner::LineNum();

		/** Retrieve the next Token.
		 * @return A pointer to a Token object. 
		 */
		Token* nextToken();

		/** Retrieve the look ahead Token.
		 * @return A pointer to a Token object. 
		 */
		Token* LookAhead();

		/** Find a Token type.
		 * @return The Token type
		 */
		Token::TokenType findTokenType();
};

#endif

